<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr1 = ["hello", "world", "web", "css", "html", "array"];
        let arr2 = ["hello", "books", "js", "web", "css", "function", "object"];

        let res = {
            diff: [],
            same: []
        };

        for (let key of arr1) {
            if (arr2.indexOf(key) >= 0) {
                res.same.push(key);
            } else {
                res.diff.push(key);
            }
        }

        for (let two of arr2) {
            if (res.same.indexOf(two) < 0 && res.diff.indexOf(two) < 0) {
                res.diff.push(two);
            }
        }

        console.log(res);

    </script>
</body>

</html>